<template>
  <el-container class="index-con">
    <el-aside :class="showclass">
      <leftnav></leftnav>
    </el-aside>
    <el-container class="main-con">
      <el-header class="index-header">
        <navcon></navcon>
      </el-header>
      <el-main class="index-main">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>
<script>
// 导入组件
import navcon from "../components/navcon.vue";
import leftnav from "../components/leftnav.vue";
export default {
  name: "index",
  data() {
    return {
      showclass: "asideshow",
      showtype: false,
    };
  },
  // 注册组件
  components: {
    leftnav,
    navcon,
  },
  methods: {},
  created() {
    // 监听
    this.$root.Bus.$on("toggle", (value) => {
      if (value) {
        this.showclass = "asideshow";
      } else {
        setTimeout(() => {
          this.showclass = "aside";
        }, 300);
      }
    });
  },
  beforeUpdate() {},
  // 挂载前状态(里面是操作)
  beforeMount() {},
};
</script>
<style >
.index-con {
  height: 100%;
  width: 100%;
  box-sizing: border-box;
}

.aside {
  width: 64px !important;
  height: 100%;
  background-color: #334157;
  margin: 0px;
}
.asideshow {
  width: 150px !important;
  height: 100%;
  background-color: rgb(2 70 162);
  margin: 0px;
}
.index-header {
  height: 47px !important;
}
.index-header,
.index-main {
  padding-top: 0px;
}
.mg-left-10 {
  margin-left: 10px;
}
.mg-bottom-10 {
  margin-bottom: 10px;
}
.mg-top-20 {
  margin-top: 20px;
}
.search-form {
  margin-top: 20px;
}
</style>
